package com.buddy.syn.method._04;

public class PublicVar {
    public String userName = "A";
    public String password = "AA";

    synchronized public void setValue(String userName,String password){
        try {
            this.userName = userName;
            Thread.sleep(5000);
            this.password = password;
            System.out.println("setValue method ThreadName= "+Thread.currentThread().getName()
                    +" ,userName="+userName+" ,password="+password);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    synchronized public void getValue(){
        System.out.println("getValue method ThreadName= "+Thread.currentThread().getName()
                +" ,userName="+userName+" ,password="+password);
    }
}
